#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

void printVec(vector<string>);

int main()
{
    vector<string> words{"the", "quick", "red", "fox", "jumps", "over", "the",
                            "slow", "red", "turtle"};
    // 按字典序排序 words，以便查找重复单词
    sort(words.begin(), words.end());
    // unique 重排输入范围，使得每个单词只出现一次
    // 排列在范围的前部，返回指向不重复区域之后一个位置的迭代器
    auto end_unique = unique(words.begin(), words.end());
    // 使用向量操作 erase 删除重复单词
    words.erase(end_unique, words.end());
    printVec(words);
}

void printVec(vector<string> v)
{
    for (string s : v)
        cout << s << " ";
    cout << endl;
}